'use strict';
const Service = require('egg').Service;

class Search extends Service {
    /**
     * @params {name, author}
     * @bussiness {小说关键词查询}
     * @author JC
     * @date 2022-08-15
     * **/
    async searchNovelsOrAuthorByClassesOrName(params) {
        try {
            // 拿到书籍信息与作者
            let novels = await this.app.mysql.select('novels', {
                where: {
                    name: params.name
                }
            }) // 书名搜索

            let an = await this.app.mysql.select('novels', {where:{author_name:params.author_name}})
            let data = [...novels, ...an]
            return data


        } catch (e) {

        }
    }
}
module.exports = Search;